<template>
    <a-card :bordered="false">
        <!-- 查询区域 -->
        <div class="table-page-search-wrapper">
            <a-form @keyup.enter.native="searchQuery" layout="inline">
                <a-row :gutter="24">
                    <a-col :md="6" :sm="8">
                        <a-form-item label="真实姓名">
                            <a-input placeholder="请输入真实姓名" v-model="queryParam.userName">
                            </a-input>
                        </a-form-item>
                    </a-col>
                    <a-col :md="6" :sm="8">
<span class="table-pagesearch-submitButtons" style="float: left;overflow: hidden;">
<a-button @click="searchQuery" icon="search" type="primary">查询
</a-button>
<a-button @click="searchReset" icon="reload" style="margin-left: 8px"
          type="primary">重置</a-button>
<a @click="handleToggleSearch" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
</span>
                    </a-col>
                </a-row>
            </a-form>
        </div>
        <!-- 查询区域-END -->
        <!-- 操作按钮区域 -->
        <div class="table-operator">
        </div>
        <!-- table区域-begin -->
        <div>
            <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
                <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
                    style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
                <a @click="onClearSelected" style="margin-left: 24px">清空</a>
            </div>
            <a-table
                    :columns="columns"
                    :dataSource="dataSource"
                    :loading="loading"
                    :pagination="ipagination"
                    :rowSelection="{selectedRowKeys: selectedRowKeys, onChange:onSelectChange}"
                    :scroll="{x:true}"
                    @change="handleTableChange"
                    bordered
                    class="j-table-force-nowrap"
                    ref="table"
                    rowKey="id"
                    size="middle">
                <template slot="htmlSlot" slot-scope="text" >
                    <div v-html="text"></div>
                </template>
                <template slot="imgSlot" slot-scope="text">
<span style="font-size: 12px;font-style: italic;" v-if="!text">无图片
</span>
                    <img :src="getImgView(text)" alt="" height="25px"
                         style="maxwidth:80px;font-size: 12px;font-style: italic;"
                         v-else/>
                </template>
                <template slot="fileSlot" slot-scope="text">
<span style="font-size: 12px;font-style: italic;" v-if="!text">无文件
</span>
                    <a-button
                            :ghost="true"
                            @click="downloadFile(text)"
                            icon="download"
                            size="small"
                            type="primary"
                            v-else>
                        下载
                    </a-button>
                </template>
                <!--信息是否已完善模板-->
                <template slot="isFinish" slot-scope="isFinish">
                    <a-tag color="green" v-if="isFinish === 1">是</a-tag>
                    <a-tag color="red" v-if="isFinish === 2">否</a-tag>
                </template>
                <span slot="action" slot-scope="text, record">
<a v-if="record.isFinish === 1" @click="handleRecord(record)">预约记录</a>
<a-tag v-else color="red">信息未完善</a-tag>
<a-divider type="vertical"/>
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleEdit(record)">编辑</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() =>
handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
            </a-table>
        </div>
        <sdxc-reserve-user-modal @ok="modalFormOk" ref="modalForm"></sdxc-reserve-user-modal>
        <!--预约记录模态框-->
        <SdxcReserveUserRecordModal ref="SdxcReserveUserRecordModal"></SdxcReserveUserRecordModal>
    </a-card>
</template>
<script>
    import '@/assets/less/TableExpand.less'
    import { mixinDevice } from '@/utils/mixin'
    import { JeecgListMixin } from '@/mixins/JeecgListMixin'
    import SdxcReserveUserModal from './modules/SdxcReserveUserModal'
    import SdxcReserveUserRecordModal from './modules/SdxcReserveUserRecordModal'

    export default {
        name: 'SdxcReserveUserList',
        mixins: [JeecgListMixin, mixinDevice],
        components: {
            SdxcReserveUserModal,SdxcReserveUserRecordModal
        },
        data() {
            return {
                description: '用户管理管理页面',
// 表头
                columns: [
                    {
                        title: '真实姓名',
                        align: 'center',
                        dataIndex: 'userName'
                    },
                    {
                        title: '身份证号',
                        align: 'center',
                        dataIndex: 'idCard'
                    },
                    {
                        title: '联系电话',
                        align: 'center',
                        dataIndex: 'phone'
                    },
                    {
                        title: '工作单位',
                        align: 'center',
                        dataIndex: 'workUnit'
                    },
                    {
                        title: '信息是否完善',
                        align: 'center',
                        dataIndex: 'isFinish',
                        scopedSlots: { customRender: 'isFinish' },
                    },
                    {
                        title: '操作',
                        dataIndex: 'action',
                        align: 'center',
                        fixed: 'right',
                        width: 147,
                        scopedSlots: { customRender: 'action' }
                    }
                ],
                url: {
                    list: '/reserve/sdxcReserveUser/list',
                    delete: '/reserve/sdxcReserveUser/delete',
                    deleteBatch: '/reserve/sdxcReserveUser/deleteBatch',
                },
                dictOptions: {},
            }
        },
        created() {
        },
        computed: {},
        methods: {
            /**
             * 插看预约记录
             *
             * @param record
             */
            handleRecord: function (record) {
                this.$refs.SdxcReserveUserRecordModal.edit(record);
                this.$refs.SdxcReserveUserRecordModal.title = "预约记录";
                this.$refs.SdxcReserveUserRecordModal.disableSubmit = false;
            },

            initDictConfig() {
            }
        }
    }
</script>
<style scoped>
    @import '~@assets/less/common.less';
</style>
